//
// C++ Interface: gdockwidget
//
// Description: 
//
//
// Author: Grzegorz Latarowski <grzesiek@grzesiek>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//


/// \file gdockwidet.h Header file for a subclass of QDockWidget.




#ifndef GDOCKWIDGET_H
#define GDOCKWIDGET_H


#include <QDockWidget>



// --------------------------- GDockWidet{} ----------------------------------
/// A subclass of a \e QDockWidget with \e visibleChanged() signal
/// emitted whenever widgets visible changed.
// ---------------------------------------------------------------------------
class GDockWidget : public QDockWidget
{
	Q_OBJECT
			
public:
	
	// ====================================================
	// constructors/destructor
	
	/// Constructs \e GDockWidget object. Copies params to \e QDockWidget constructor.
	GDockWidget( const QString & title, QWidget * pParent = 0, Qt::WindowFlags flags = 0 )
	: QDockWidget( title, pParent, flags ) {}
	
	/// Constructs \e GDockWidget object. Copies params to \e QDockWidget constructor.
	GDockWidget( QWidget * pParent = 0, Qt::WindowFlags flags = 0 )
	: QDockWidget( pParent, flags ) {}
	
	/// Destroys the dock widget.
	~GDockWidget() {}
	
	
protected:
	
	/// Calls native \e QDockWidget::hideEvent() and emits \e visibleChanged(() signal.
	virtual void hideEvent( QHideEvent * pEvent )
	{
		QDockWidget::hideEvent( pEvent );
		emit visibleChanged( isVisible() );
	}
	
	/// Calls native \e QDockWidget::showEvent() and emits \e visibleChanged(() signal.
	virtual void showEvent( QShowEvent * pEvent )
	{
		QDockWidget::showEvent( pEvent );
		emit visibleChanged( isVisible() );
	}
	
	/// Calls native \e QDockWidget::showEvent() and emits \e visibleChanged(() signal.
// 	virtual void closeEvent( QCloseEvent * pEvent )
// 	{
// 		QDockWidget::closeEvent( pEvent );
// 		emit visibleChanged( isVisible() );
// 	}
	
	
	
signals:
	/// Emitted whenever widgets visibility changed.
	void visibleChanged( bool visible );

}; // class !GDockWidet
// ---------------------------------------------------------------------------




#endif // !GDOCKWIDGET_H

// eof
